#@layoutT("列表首页")
#define main()
#@formStart()
#@queryStart('名称')
<input type="search" name="name" autocomplete="off" class="layui-input" placeholder="名称"/>
#@queryEnd()
#@queryStart('分类')
<input type="search" name="type" autocomplete="off" class="layui-input" placeholder="分类"/>
#@queryEnd()
#@formEnd()
<input type="hidden" class="layui-input" id="orderId" name="orderId" value="#(orderId??)"/>
<!-- 表头按钮 -->
<div class='layui-row f-index-toolbar'>
    <div class='layui-col-xs12'>
        <div class="layui-btn-group">
            <button id='addBtn_' class="layui-btn layui-btn-normal layui-btn-sm">
                <i class="layui-icon">&#xe608;</i> 新增
            </button>
            <button id='refreshBtn_' class="layui-btn layui-btn-normal layui-btn-sm">
                <i class="layui-icon">&#xe669;</i> 刷新
            </button>
            <button id='deleteBtn_' class="layui-btn  layui-btn-normal layui-btn-sm">
                <i class="layui-icon">&#xe640;</i> 删除
            </button>
        </div>
    </div>
</div>

<!-- 表格列表 -->
<div class="layui-row  f-index-toolbar">
    <div class="layui-col-xs12">
        <table id="maingrid" lay-filter="maingrid"></table>
    </div>
</div>

<!-- 	每行的操作按钮 -->
<script type="text/html" id="bar_maingrid">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
</script>
#end

#define js()
<!-- 分页表格 -->
<script>
    gridArgs.title='订单明细';
    gridArgs.dataId='detail_id';
    gridArgs.deleteUrl='#(path)/erp/order/sellDetail/delete?primaryKey='+gridArgs.dataId;
    gridArgs.updateUrl='#(path)/erp/order/sellDetail/edit?&detailId=';
    gridArgs.addUrl='#(path)/erp/order/sellDetail/add?orderId='+$("#orderId").val();
    gridArgs.gridDivId ='maingrid';
    initGrid({id : 'maingrid'
        ,elem : '#maingrid'
        ,cellMinWidth: 80
        ,cols : [ [
            {title: '主键',field : 'detail_id',width : 35,checkbox : true},
            {title: '序号',type:'numbers',width:35},
            {title: '物品', field: 'entity_name' },
            {title: '所属上级', field: 'par_entity_name'},
            {title: '计量单位', field: 'unit'},
            {title: '数量', field: 'amount'},
            {title: '价格', field: 'price'},
            {title: '折扣', field: 'discount'},
            {title: '金额', field: 'sum_money'},
            {title: '操作',fixed:'right',width : 180,align : 'left',toolbar : '#bar_maingrid'} // 这里的toolbar值是模板元素的选择器
        ] ]
        ,url:'#(path)/erp/order/sellDetail/list?orderId='+$("#orderId").val()
        ,where:{"object":"sys_tree","primaryKey":gridArgs.dataId}
        ,searchForm : 'searchForm'
    });
</script>

#end